class Animal{
    public String name;
    public int age;

    /*public Animal(){
        System.out.println("Animal_init(不带参数的构造方法)");
    }*/

    static {
        System.out.println("Dog的静态代码块！");
    }
    {
        System.out.println("Dog的实例代码块！");
    }

    public Animal(String name,int age){
        this.name = name;
        this.age = age;
        System.out.println("Animal的带有2个参数的构造方法！");
    }

    public void sleep(){
        System.out.println(this.name + "在吃饭!");
    }
    public void bark(){
        System.out.println(this.name + "在叫!");
    }
}

class Dog extends Animal{
//    public Dog(){
//
//    }
    public Dog(){
        super("haha",6);
        System.out.println("Dog的不带参数的构造方法！");
    }
    public void swim(){
        System.out.println(this.name + "在狗刨!" + "年龄：" + this.age);
    }
}
class Bird extends Animal{
//    public BIRD(){
//
//    }
    public Bird(String name,int age){
        super(name,age);
        System.out.println("Animal的不带参数的构造方法！");
    }
    public String wing;//翅膀
    public void fly(){
        System.out.println(this.name + "在飞!");
    }
}

public class TestODemo {
    public static void main(String[] args) {
        Dog dog1 = new Dog();
        System.out.println("===========");
        Dog dog2 = new Dog();
    }

    public static void main2(String[] args) {
        Dog dog = new Dog();
        dog.swim();
        System.out.println("===========");
        Bird bird = new Bird("heihei",7);
        bird.fly();
    }
    public static void main1(String[] args) {
        Dog dog = new Dog();
        dog.name = "旺财!";
        dog.bark();
        dog.swim();
        System.out.println("===========");
        //Bird bird = new Bird();
        //bird.name = "shjhio";
        //bird.bark();
        //bird.fly();
    }
}
